<template>
	<view class="ss-flex-col gap-24">
		<view @tap="handleDetail(item)" v-for="(item,index) in list" :key="index" class="item-box">
			<view class="ss-flex ss-row-between">
				<view class="ss-flex-col font-w-500">
					<view class=" fs-36">{{ item.car_number }}</view>
					<view class="fc-dark9 fs-24 ss-m-t-16">{{ sheep.$helper.timeFrom(item.createtime) }}</view>
				</view>
				<view class="fs-30 fc-error">{{ orderStatus[item.status]?.name }}</view>
			</view>
			<applyFlow :info="item" />
			<uv-line v-if="item.q_remake" color="#eee" margin="24rpx 0"></uv-line>
			<view v-if="item.q_remake" class="fs-26">
				<text class="fc-dark9">审核意见：</text>
				<text class="fc-dark6">自动审核通过</text>
			</view>
			<view v-if="item.status == QUANXIAN.CONFIRM || item.status == QUANXIAN.CHECK || item.status == QUANXIAN.REVIEW" class="ss-flex ss-row-right ss-w-100 gap-24 ss-m-t-32">
				<z-button @tap.stop="recheckOrder(item)" v-if="!item.fujian_file && (item.status == QUANXIAN.CHECK || item.status == QUANXIAN.REVIEW)" width="307" height="68" bgColor="rgba(51,214,94,0.1)" color="#33D65E">复检</z-button>
				<z-button width="307" style="color:#fff;" v-if="item.status == QUANXIAN.CONFIRM && myQuanxian.includes(QUANXIAN.CONFIRM)" height="68" bg-color="#33D65E">确认</z-button>
				<z-button width="307" style="color:#fff;" v-if="item.status == QUANXIAN.CHECK && myQuanxian.includes(QUANXIAN.CHECK)" height="68" bg-color="#33D65E">审核</z-button>
				<z-button width="307" style="color:#fff;" v-if="item.status == QUANXIAN.REVIEW && myQuanxian.includes(QUANXIAN.REVIEW)"  height="68" bg-color="#33D65E">复核</z-button>
			</view>
		</view>
	</view>
</template>

<script setup>
	import sheep from "@/sheep"
	import applyFlow from "@/pages/components/applyFlow.vue"
	import { orderStatus,QUANXIAN } from "@/sheep/enu/index.js"
	const props = defineProps({
		list: {
			type: Array,
			default: () => {
				return []
			}
		}
	})
	const userInfo = computed(() => sheep.$store("user").userInfo)
	const myQuanxian = computed(() => {
		const storesf = userInfo.value?.storesf
		return storesf?.quan_iddata?.split(',')
	})
	function handleDetail(info = {}){
		let url = ''
		if(info.status == QUANXIAN.CONFIRM && myQuanxian.value.includes(QUANXIAN.CONFIRM)) {
			url = '/pages/order/confirmOrder'		
		}else if(info.status == QUANXIAN.CHECK && myQuanxian.value.includes(QUANXIAN.CHECK)) {
			url = '/pages/order/reviewOrder'		
		}else if(info.status == QUANXIAN.REVIEW && myQuanxian.value.includes(QUANXIAN.REVIEW)) {
			url = '/pages/order/checkDetail'		
		}else {
			url = '/pages/order/detail'
		}
		sheep.$router.go(url,{id:info.id})
	}
	function recheckOrder(item){
		sheep.$router.go('/pages/order/testReport',{order_id:item.id})
	}
</script>

<style scoped lang="scss">
	.item-box {
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 24rpx;
		// margin: 0 32rpx 24rpx;
	}
</style>